var e = require("../../common/vendor.js"), o = require("../../uni_modules/u-store/js_sdk/Storage.js"), t = {
    namespaced: !0,
    state: function() {
        return {
            token: o.Storage.get("token") || "",
            userid: o.Storage.get("userid") || 0,
            userInfo: o.Storage.get("userInfo") || {},
            hasLogin: o.Storage.get("hasLogin") || !1
        };
    },
    mutations: {
        login: function(e, t) {
            var r = t.token, s = t.user_id, n = t.user_info;
            e.hasLogin = !0, e.token = r, e.userid = s, e.userInfo = n, o.Storage.set("token", r), 
            o.Storage.set("userid", s), o.Storage.set("hasLogin", !0), o.Storage.set("userInfo", n);
        },
        logout: function(t) {
            e.index.clearStorage();
            var r = {
                mobile: "请登录",
                nick_name: "游客",
                avatar: "/static/default-avatar.png"
            };
            t.hasLogin = !1, t.token = "", t.userid = 0, t.userInfo = r, o.Storage.set("token", ""), 
            o.Storage.set("userid", 0), o.Storage.set("hasLogin", !1), o.Storage.set("userInfo", r);
        },
        upInfo: function(e, t) {
            e.userInfo = t, o.Storage.set("userInfo", t);
        }
    }
};

exports.userModel = t;